package me.liekkas.notify.sms;

import java.util.Map;

public abstract class AbstractMailSender implements ISmsSend {

    protected Map<BizTypeEnum, ITemplate> templateMap;

    /**
     * 发送
     *
     * @param request
     * @return
     */
    @Override
    public final SmsResponse send(SmsRequest request) {
        // 准备参数
        init();
        // 发送
        SmsResponse response = doSend(request);
        // 记录日志
        log(request, response);
        return response;
    }

    protected abstract void init();

    protected abstract SmsResponse doSend(SmsRequest request);

    protected abstract void log(SmsRequest request, SmsResponse response);


    public Map<BizTypeEnum, ITemplate> getTemplateMap() {
        return templateMap;
    }
}
